package com.itheima.thread.threadPool.future;

import java.util.concurrent.Callable;

/**
 * @Author: Ethan Yankang
 * @Program: Interview
 * @Date: 2024-08-15 21:34
 **/
public class MyCall implements Callable<Integer> {
     private int a;
    private int b;
    //通过构造方法传递两个参数

    public MyCall(int a, int b) {
        this.a = a;
        this.b = b;
    }

    @Override
    public Integer call() throws Exception {
        String name = Thread.currentThread().getName();
        System.out.println(name+"准备开始计算...");
        Thread.sleep(2000);
        System.out.println(name+"计算完成...");
        return a+b;
    }
}
